package com.meituan.catering.management.order.biz.model.converter;

import com.meituan.catering.management.order.biz.model.CateringOrderBO;
import com.meituan.catering.management.order.biz.model.CateringOrderDetailBO;
import com.meituan.catering.management.order.biz.model.CateringOrderItemAccessoryBO;
import com.meituan.catering.management.order.biz.model.CateringOrderItemBO;
import org.apache.commons.collections4.CollectionUtils;

import java.util.Collections;
import java.util.List;

/**
 * @author Believe
 * Date 2022/5/28 14:24
 */
public class CateringOrderDetailBOConverter {
    public static CateringOrderDetailBO toCateringOrderDetailBO(CateringOrderBO cateringOrderBO,
                                                                List<CateringOrderItemBO> orderItemBOList,
                                                                List<CateringOrderItemAccessoryBO> orderItemAccessoryBOList) {
        if (CollectionUtils.isEmpty(orderItemAccessoryBOList)) {
            return new CateringOrderDetailBO(cateringOrderBO, orderItemBOList, Collections.emptyList());
        }
        return new CateringOrderDetailBO(cateringOrderBO, orderItemBOList, orderItemAccessoryBOList);
    }

}
